home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1999 April / Cd Pc Users extra 19 abril 1999.iso / Prog / Inst / Js02 / js02.exe / jscripts / mvuplfl3v02.js < prev    next >
Encoding:
JavaScript  |  1998-12-27  |  6.2 KB  |  166 lines

  1. //----------------------------------------------------------------------
  2. // JavaScript Code for Navigator 4+ and Internet Explorer 4+
  3. //-------------------------------------------------------------------
  4. // Moving Object Down and Right For Two Objects Layers
  5. // signe_browser=0: Netscape Navigator 4 & signe_browser=1: Internet Explorer 4
  6. // ly1:         frame object which is not moving
  7. // ly2:         child frame object which is not moving
  8. // ly3:         object which is moving
  9. // signe_up=0     Initialization
  10. // newposUp:     New Position of Object ; newposUp=0 (initial value for Navigator)
  11. // limitStep:     pixel size for step  
  12. // stepUp:      pixel size initial for step
  13. // dtime:         timeout for moving object in ms
  14. // ex: movingL3UpLfV02(nbrowser,'sawo','sawo2','sawo3',0,200,200,1,1,1,100,100,20,20,600,600,100);
  15. // stepUp=limitStep : constant mouvement; 
  16. //---------------------------------------------------------------------
  17.  
  18. var timeout_id_movingL3UpLfV02=new initArray();
  19. function movingL3UpLfV02(signe_browser,nbmoving,signe_moving,ly1,ly2,ly3,signe_up,newposUp,newposLeft,signeTop,signe1,signe2,stepUpTp,stepUpLf,limitStep,limitTop,limitLeft,dtime){
  20.     if (signe_moving==0){
  21.     if (signe_up==0) {
  22.         if (signe_browser==0) {
  23.             newposUp=document[ly1].document[ly2].document[ly3].top;
  24.             newposLeft=document[ly1].document[ly2].document[ly3].left;
  25.         }
  26.  
  27.         signe_up=1;
  28.     }
  29.  
  30.     if (signeTop==1){
  31.  
  32.         if (signe1==1){
  33.  
  34.             if (newposUp < limitTop){    
  35.                   newposUp=newposUp+signe1*stepUpTp;
  36.                   newposLeft=newposLeft+signe2*stepUpLf;
  37.  
  38.                 if (stepUpTp > limitStep) stepUpTp=stepUpTp/2;
  39.                 if (stepUpLf > limitStep) stepUpLf=stepUpLf/2;
  40.  
  41.                 if (signe_browser==0) {
  42.                     document[ly1].document[ly2].document[ly3].top=newposUp;
  43.                     document[ly1].document[ly2].document[ly3].left=newposLeft;
  44.                 }
  45.                 if (signe_browser==1) {
  46.                     document.all[ly1].document.all[ly2].document.all[ly3].style.top=newposUp;
  47.                     document.all[ly1].document.all[ly2].document.all[ly3].style.left=newposLeft;
  48.                 }
  49.                   timeout_id_movingL3UpLfV02[nbmoving]=setTimeout("movingL3UpLfV02("+signe_browser+","+nbmoving+","+signe_moving+",'"+ly1+"','"+ly2+"','"+ly3+"',"+signe_up+","+newposUp+","+newposLeft+","+signeTop+","+signe1+","+signe2+","+stepUpTp+","+stepUpLf+","+limitStep+","+limitTop+","+limitLeft+","+dtime+")", dtime);
  50.                   return;
  51.             }
  52.  
  53.               if (newposUp >= limitTop ) {
  54.                 clearTimeout(timeout_id_movingL3UpLfV02[nbmoving]);
  55.                 timeout_id_movingL3UpLfV02[nbmoving]=null;
  56.                 end_movingL3UpLfV02(ly1,ly2,ly3);
  57.             }
  58.  
  59.         }
  60.         if (signe1==-1){
  61.  
  62.             if (newposUp > limitTop){    
  63.                   newposUp=newposUp+signe1*stepUpTp;
  64.                   newposLeft=newposLeft+signe2*stepUpLf;
  65.  
  66.                 if (stepUpTp > limitStep) stepUpTp=stepUpTp/2;
  67.                 if (stepUpLf > limitStep) stepUpLf=stepUpLf/2;
  68.  
  69.                 if (signe_browser==0) {
  70.                     document[ly1].document[ly2].document[ly3].top=newposUp;
  71.                     document[ly1].document[ly2].document[ly3].left=newposLeft;
  72.                 }
  73.                 if (signe_browser==1) {
  74.                     document.all[ly1].document.all[ly2].document.all[ly3].style.top=newposUp;
  75.                     document.all[ly1].document.all[ly2].document.all[ly3].style.left=newposLeft;
  76.                 }
  77.                   timeout_id_movingL3UpLfV02[nbmoving]=setTimeout("movingL3UpLfV02("+signe_browser+","+nbmoving+","+signe_moving+",'"+ly1+"','"+ly2+"','"+ly3+"',"+signe_up+","+newposUp+","+newposLeft+","+signeTop+","+signe1+","+signe2+","+stepUpTp+","+stepUpLf+","+limitStep+","+limitTop+","+limitLeft+","+dtime+")", dtime);
  78.                   return;
  79.             }
  80.               if (newposUp <= limitTop ) {
  81.                 clearTimeout(timeout_id_movingL3UpLfV02[nbmoving]);
  82.                 timeout_id_movingL3UpLfV02[nbmoving]=null;
  83.                 end_movingL3UpLfV02(ly1,ly2,ly3);
  84.             }
  85.  
  86.  
  87.         }
  88.     }
  89.  
  90.  
  91.     if (signeTop==0){
  92.  
  93.         if (signe2==1){
  94.  
  95.             if (newposLeft < limitLeft){    
  96.                   newposUp=newposUp+signe1*stepUpTp;
  97.                   newposLeft=newposLeft+signe2*stepUpLf;
  98.  
  99.                 if (stepUpTp > limitStep) stepUpTp=stepUpTp/2;
  100.                 if (stepUpLf > limitStep) stepUpLf=stepUpLf/2;
  101.  
  102.                 if (signe_browser==0) {
  103.                     document[ly1].document[ly2].document[ly3].top=newposUp;
  104.                     document[ly1].document[ly2].document[ly3].left=newposLeft;
  105.                 }
  106.                 if (signe_browser==1) {
  107.                     document.all[ly1].document.all[ly2].document.all[ly3].style.top=newposUp;
  108.                     document.all[ly1].document.all[ly2].document.all[ly3].style.left=newposLeft;
  109.                 }
  110.                   timeout_id_movingL3UpLfV02[nbmoving]=setTimeout("movingL3UpLfV02("+signe_browser+","+nbmoving+","+signe_moving+",'"+ly1+"','"+ly2+"','"+ly3+"',"+signe_up+","+newposUp+","+newposLeft+","+signeTop+","+signe1+","+signe2+","+stepUpTp+","+stepUpLf+","+limitStep+","+limitTop+","+limitLeft+","+dtime+")", dtime);
  111.                   return;
  112.             }
  113.  
  114.               if (newposLeft >= limitLeft ) {
  115.                 clearTimeout(timeout_id_movingL3UpLfV02[nbmoving]);
  116.                 timeout_id_movingL3UpLfV02[nbmoving]=null;
  117.                 end_movingL3UpLfV02(ly1,ly2,ly3);
  118.             }
  119.  
  120.  
  121.         }
  122.         if (signe2==-1){
  123.  
  124.             if (newposLeft > limitLeft){    
  125.                   newposUp=newposUp+signe1*stepUpTp;
  126.                   newposLeft=newposLeft+signe2*stepUpLf;
  127.  
  128.                 if (stepUpTp > limitStep) stepUpTp=stepUpTp/2;
  129.                 if (stepUpLf > limitStep) stepUpLf=stepUpLf/2;
  130.  
  131.                 if (signe_browser==0) {
  132.                     document[ly1].document[ly2].document[ly3].top=newposUp;
  133.                     document[ly1].document[ly2].document[ly3].left=newposLeft;
  134.                 }
  135.                 if (signe_browser==1) {
  136.                     document.all[ly1].document.all[ly2].document.all[ly3].style.top=newposUp;
  137.                     document.all[ly1].document.all[ly2].document.all[ly3].style.left=newposLeft;
  138.                 }
  139.                   timeout_id_movingL3UpLfV02[nbmoving]=setTimeout("movingL3UpLfV02("+signe_browser+","+nbmoving+","+signe_moving+",'"+ly1+"','"+ly2+"','"+ly3+"',"+signe_up+","+newposUp+","+newposLeft+","+signeTop+","+signe1+","+signe2+","+stepUpTp+","+stepUpLf+","+limitStep+","+limitTop+","+limitLeft+","+dtime+")", dtime);
  140.                   return;
  141.             }
  142.               if (newposLeft <= limitLeft ) {
  143.                 clearTimeout(timeout_id_movingL3UpLfV02[nbmoving]);
  144.                 timeout_id_movingL3UpLfV02[nbmoving]=null;
  145.                 end_movingL3UpLfV02(ly1,ly2,ly3);
  146.             }
  147.  
  148.  
  149.         }
  150.     }
  151.     }
  152.     if (signe_moving==1) {
  153.         clearTimeout(timeout_id_movingL3UpLfV02[nbmoving]);
  154.         timeout_id_movingL3UpLfV02[nbmoving]=null;
  155.         end_movingL3UpLfV02(ly1,ly2,ly3);
  156.     }
  157.  
  158. }
  159.  
  160. function end_movingL3UpLfV02(ly1,ly2,ly3){}
  161.  
  162.  
  163.  
  164.  
  165.  
  166.